<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Stalin Protocol Benchmark: Udp Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Stalin Protocol Benchmark
   </div>
   <div id="projectbrief">A Democratic benchmark by the people, for the people.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_udp-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Udp Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Binds and socket and provides methods for sending and receiving datagram messages.  
 <a href="class_udp.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_udp_8h_source.html">Udp.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af02656c58abb169fed14879aa301d8b5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp.html#af02656c58abb169fed14879aa301d8b5">Udp</a> (void)</td></tr>
<tr class="memdesc:af02656c58abb169fed14879aa301d8b5"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> <a class="el" href="class_udp.html" title="Binds and socket and provides methods for sending and receiving datagram messages. ">Udp</a> default constructor.  <a href="#af02656c58abb169fed14879aa301d8b5">More...</a><br/></td></tr>
<tr class="separator:af02656c58abb169fed14879aa301d8b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a59d0fcaf80186548de9e01449dcdfc56"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp.html#a59d0fcaf80186548de9e01449dcdfc56">SecureHost</a> (const char *const ipAddress, int portNum)</td></tr>
<tr class="memdesc:a59d0fcaf80186548de9e01449dcdfc56"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Binds a socket and port number and looks up a host name.  <a href="#a59d0fcaf80186548de9e01449dcdfc56">More...</a><br/></td></tr>
<tr class="separator:a59d0fcaf80186548de9e01449dcdfc56"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac5c5629d5372ec0b693b4b207c7f7cf"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp.html#aac5c5629d5372ec0b693b4b207c7f7cf">BindSocket</a> (int portNum)</td></tr>
<tr class="memdesc:aac5c5629d5372ec0b693b4b207c7f7cf"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Binds a UDP socket and port number.  <a href="#aac5c5629d5372ec0b693b4b207c7f7cf">More...</a><br/></td></tr>
<tr class="separator:aac5c5629d5372ec0b693b4b207c7f7cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a78da622d0b317ffe20ca1f20ea4f5311"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp.html#a78da622d0b317ffe20ca1f20ea4f5311">ReadMsg</a> (char *buffer, int buf_size)</td></tr>
<tr class="memdesc:a78da622d0b317ffe20ca1f20ea4f5311"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Reads a UDP message from a socket.  <a href="#a78da622d0b317ffe20ca1f20ea4f5311">More...</a><br/></td></tr>
<tr class="separator:a78da622d0b317ffe20ca1f20ea4f5311"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2fa8b855a78c2707a10f5fff95b4234f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp.html#a2fa8b855a78c2707a10f5fff95b4234f">SendMsg</a> (const char *const ipAddress, int type, short length, const char *message)</td></tr>
<tr class="memdesc:a2fa8b855a78c2707a10f5fff95b4234f"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Sends a UDP message.  <a href="#a2fa8b855a78c2707a10f5fff95b4234f">More...</a><br/></td></tr>
<tr class="separator:a2fa8b855a78c2707a10f5fff95b4234f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Binds and socket and provides methods for sending and receiving datagram messages. </p>
<p>The <a class="el" href="class_udp.html" title="Binds and socket and provides methods for sending and receiving datagram messages. ">Udp</a> class contains the methods required for binding a socket and sending and receiving datagram messages. It currently only supports binding one socket at a time. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="af02656c58abb169fed14879aa301d8b5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Udp::Udp </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> <a class="el" href="class_udp.html" title="Binds and socket and provides methods for sending and receiving datagram messages. ">Udp</a> default constructor. </p>
<p><b>Detailed Description:</b> Default constructor for the <a class="el" href="class_udp.html" title="Binds and socket and provides methods for sending and receiving datagram messages. ">Udp</a> class. It initializes the comSocket and portNum to known values. </p>
<p>&lt; Socket that the connection is made through</p>
<p>&lt; Port number that messages are sent or received from. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aac5c5629d5372ec0b693b4b207c7f7cf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Udp::BindSocket </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>portNum</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Binds a UDP socket and port number. </p>
<p><b>Detailed Description:</b> Binds a socket and port number based on the port number provided for use with the UDP protocol.</p>
<p>[in] portNum <b> int </b> The port number the socket will bound on.</p>
<dl class="section return"><dt>Returns</dt><dd>returnStatus <b> int </b> The status of binding the socket. 0 = Failed, 1 = Success. </dd></dl>

</div>
</div>
<a class="anchor" id="a78da622d0b317ffe20ca1f20ea4f5311"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Udp::ReadMsg </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>buf_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Reads a UDP message from a socket. </p>
<p><b>Detailed Description:</b> Reads a message of a socket using the UDP protocol. The message is stored in the buffer provided.</p>
<p>[in] buffer <b> int </b> The buffer the message will be stored in. [in] buf_size <b> int </b> The expected size of the message. </p>
<dl class="section return"><dt>Returns</dt><dd>bytesRead <b> int </b> The number of bytes read. </dd></dl>

</div>
</div>
<a class="anchor" id="a59d0fcaf80186548de9e01449dcdfc56"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Udp::SecureHost </td>
          <td>(</td>
          <td class="paramtype">const char *const&#160;</td>
          <td class="paramname"><em>ipAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>portNum</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Binds a socket and port number and looks up a host name. </p>
<p><b>Detailed Description:</b> Binds a socket and port number and looks up for a host name based on the ip address and port number provided.</p>
<p>[in] ipAddress <b> const char * const </b> The ip address we are using to get the host. [in] portNum <b> int </b> The port number the socket will bound on. </p>
<dl class="section return"><dt>Returns</dt><dd>returnStatus <b> int </b> Status of securing a host. 0 = Failed, 1 = Success. </dd></dl>

</div>
</div>
<a class="anchor" id="a2fa8b855a78c2707a10f5fff95b4234f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Udp::SendMsg </td>
          <td>(</td>
          <td class="paramtype">const char *const&#160;</td>
          <td class="paramname"><em>ipAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">short&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>message</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Sends a UDP message. </p>
<p><b>Detailed Description:</b> Sends a message using using the UDP protocol to the address specified.</p>
<p>[in] ipAddress <b> const char * const </b> The address we are sending the message to. [in] type <b> int </b> The type of message we sending. [in] length <b> short </b> The length of the message we are sending. [in] message <b> const char * </b> The buffer containing the message we are sending.</p>
<dl class="section return"><dt>Returns</dt><dd>bytesSent <b> int </b> The number of bytes sent. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>trunk/IADA1/inc/<a class="el" href="_udp_8h_source.html">Udp.h</a></li>
<li>trunk/IADA1/src/<a class="el" href="_udp_8cpp.html">Udp.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Jan 28 2014 20:53:42 for Stalin Protocol Benchmark by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
